clc;
N = 16;
% n就从0到 7
n = 0:N-1;


xn = sin(0.5*pi*n+0.2*pi);
yn = xn(mod(n,N)+1);

k = 0:N-1;
% 旋转因子
WN = exp(-j*2*pi/N);
nk = n'*k;
WNnk = WN.^nk;
Xk = xn * WNnk;
Yk = yn * WNnk;
figure(1)
% 绘制离散数据图
stem(n,xn)
figure(2)
stem(k,abs(Xk));
figure(3)
stem(n,yn)
figure(4)
stem(k,abs(Yk));